package com.frank.yinyuetai.Fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.frank.yinyuetai.Bean.YueDanDetailBean;
import com.frank.yinyuetai.R;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/8/19 0019.
 */
public class YueDanDescribeFragment extends Fragment {
    @Bind(R.id.artistName)
    TextView artistName;
    @Bind(R.id.author)
    TextView author;
    @Bind(R.id.update_date)
    TextView updateDate;
    @Bind(R.id.play_count)
    TextView playCount;
    @Bind(R.id.play_pc_count)
    TextView playPcCount;
    @Bind(R.id.play_mobile_count)
    TextView playMobileCount;
    @Bind(R.id.describe)
    TextView describe;
    private YueDanDetailBean yueDanDetailBean;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.yuedan_describe_fragment_layout, null);
        ButterKnife.bind(this, view);
        initView();
        return view;
    }

    private void initView() {
        yueDanDetailBean = (YueDanDetailBean) getArguments().getSerializable("yueDanDetailBean");
        artistName.setText(yueDanDetailBean.getTitle());
        author.setText("作者：" + yueDanDetailBean.getCreator().getNickName());
        updateDate.setText("更新时间：" + yueDanDetailBean.getUpdateTime());
        playCount.setText("播放次数：" + yueDanDetailBean.getTotalViews());
        playPcCount.setText("收藏次数：" + yueDanDetailBean.getTotalFavorites());
        playMobileCount.setText("获得积分：" + yueDanDetailBean.getIntegral());
        describe.setText(yueDanDetailBean.getDescription());
    }

    public static YueDanDescribeFragment newInstance(YueDanDetailBean yueDanDetailBean) {
        YueDanDescribeFragment fragment = new YueDanDescribeFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("yueDanDetailBean", yueDanDetailBean);
        fragment.setArguments(bundle);
        return fragment;
    }


}
